<%@ page language="java" import="java.util.*" import="java.sql.*" import = "orm.*"  pageEncoding="utf-8" errorPage="errorPage.jsp"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<%@ page import="util.*"%>
<%@ page import="org.w3c.dom.*" %>
<%@ page import="java.io.*"%>
<%@ page import="orm.*" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href = "<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome-Online Test</title>
<link href="css/aStyles.css" rel="stylesheet" type="text/css" />
</head>

<% 	User adm  =(User) session.getAttribute("Admin");  
	if (adm == null){
		response.sendRedirect(path + "/index.jsp");
	}
%>


<%@ page import="java.util.Date" %>
<%@ page import="java.text.SimpleDateFormat" %>


<% Date dt=new Date();
   SimpleDateFormat matter1=new SimpleDateFormat("yyyy-MM-dd");
   ReadXml readnotice = new ReadXml();
   System.out.print(new File(application.getRealPath(request.getRequestURI())).getParentFile().getParentFile().getParent() +"\\xml\\notice.xml");
   Node newnotice = readnotice.getIndex(matter1.format(dt),
   new File(application.getRealPath(request.getRequestURI())).getParentFile().getParentFile().getParent() +"\\xml\\notice.xml");
%>

<body>
	<!-- CONTAINER START -->
<div id = "container">
	<!-- HEADER START -->
        <div id = "top">
        	<div id = "navigation">
            	<html:link page="/admi/admi.jsp" styleClass = "link">&nbsp;&nbsp;&nbsp;&nbsp;首页</html:link>
                <html:link page="/admi/notice.jsp" styleClass = "link">&nbsp;&nbsp;&nbsp;&nbsp;通知</html:link>
                <html:link page="/admi/accMan.jsp" styleClass = "link">&nbsp;&nbsp;&nbsp;&nbsp;帐户管理</html:link>
                <html:link page="/admi/message.jsp" styleClass = "link">&nbsp;&nbsp;&nbsp;&nbsp;留言板管理</html:link>
            </div>
        </div>
        <!-- HEADER END -->
        
   	<!-- LOGIN START -->
        <div id = "login">
        	<html:link page="" styleClass="viewTest">·查看当前考试</html:link>
          	<p><html:link page="/admi/admModifyPwd.jsp" styleClass="modifyPwd">·修改密码</html:link></p>
            <p><html:link forward="logout" styleClass="logout">·注销登录</html:link></p>
  </div>
        <!-- LOGIN END -->
        
        <!-- CLOCK START -->
  <div id = "clock">
        	<iframe src="index/clock.html" height="407" width="296" frameborder="0" scrolling="no"
            		marginheight="0" marginwidth="0" id="clockFrame" name="clockFrame"></iframe>
</div>
        <!-- CLOCK END -->
        
        <!-- MAIN START -->
      	<div id = "main">
        	<div id = "notice">
            	<a href="notice.jsp">【通知】</a>
                <table>
                	<tr>
                		<td>&nbsp;&nbsp;&nbsp;<p style="color:#000">关于</p>
                		<p style="color:#000">
                		<%!String title = "",message = "No news is good news!",date = ""; %>
                		<%
                			if(newnotice != null){
                				NodeList list = newnotice.getChildNodes();
                				for(int i =0;i< list.getLength();i++){
                					if(list.item(i) instanceof Element){
                					System.out.println(list.item(i).getNodeName());
                						if(list.item(i).getNodeName().equals("title")){
                							title = list.item(i).getTextContent();
                						}
                						
                						if(list.item(i).getNodeName().equals("message")){
                							message = list.item(i).getTextContent();
                						}
                						
                						if(list.item(i).getNodeName().equals("date")){
                							date = list.item(i).getTextContent();
                						}
                					}
                				}
                		%>
                		<%=title%>
                		<%}%>
                		</p>
                		</td>
                	</tr>
                	<tr>
                		<td>
                			&nbsp;&nbsp;&nbsp;<p style="color:#000">内容</p>
                		</td>
                	</tr>
                	<tr>
                		<td>
                			<p style="color:#000">
                			<%=message%>
                			</p>
                		</td>
                	</tr>
                	<tr>
                        <td class="time">
                        	<p style="color:#000">
                			<%=date%>
                			</p>
                        </td>
                    </tr>
                </table>
            </div>      
        </div>
	<!-- MAIN END -->
        
	<!-- FOOTER START -->
	<div id = "footer">
  </div>
	<!-- FOOTER END -->
        
  </div>
    <!-- CONTAINER END -->
    
</body>
</html>
